iT邦幫忙

2025 iThome 鐵人賽

DAY 17
0
Mobile Development

結合AI Agent技術打造自己的行程管家系列 第 17

Day17 行程管家的外貌:迎接新夥伴的註冊介面

  • 分享至 

  • xImage
  •  

在上一篇文章中,我們已經完成了 登入介面 的所有前端流程,使用者能夠順利輸入帳號密碼並進行登入。
今天,我將帶領大家打造 註冊介面 (Register UI),讓行程管家除了能登入之外,也能新增使用者帳號,正式讓 登入與註冊畫面互相串聯、跳轉連動,提升應用的完整性。

activity_register ui介面
以下是我們設計好的 activity_register.xml 程式碼:

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/main"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".ui.register.RegisterActivity">


    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="500dp"
        android:layout_gravity="center"
        android:orientation="vertical"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="70dp"
            android:layout_weight="1"
            android:orientation="horizontal">


            <ImageView
                android:id="@+id/rest_imageView"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight="3"
                android:src="@drawable/tc_icon" />

            <TextView
                android:id="@+id/rest_textView"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:text="會員註冊"
                android:gravity="center"
                android:textSize="20sp"
                android:textStyle="bold"/>

        </LinearLayout>


        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="60dp"
            android:layout_weight="1"
            android:orientation="horizontal">
            <TextView
                android:id="@+id/rest_textView_rne"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight="3"
                android:text="使用者名稱(user_name)"
                android:gravity="center"
                android:textSize="13sp"
                android:textStyle="bold"/>

            <EditText
                android:id="@+id/rest_editTextText_rne"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:ems="10"
                android:inputType="text"
                android:hint="name" />


        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="60dp"
            android:layout_weight="1"
            android:orientation="horizontal">

            <TextView
                android:id="@+id/rest_textView_rel"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight="3"
                android:gravity="center"
                android:text="電子信箱(email)"
                android:textSize="13sp"
                android:textStyle="bold"/>

            <EditText
                android:id="@+id/rest_editTextTextEmailAddress_rem"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:ems="10"
                android:inputType="textEmailAddress"
                android:hint="email" />


        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="60dp"
            android:layout_weight="1"
            android:orientation="horizontal">
            <TextView
                android:id="@+id/rest_textView_rpw"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight="3"
                android:text="密碼(password)"
                android:textStyle="bold"
                android:textSize="13sp"
                android:gravity="center"/>

            <EditText
                android:id="@+id/rest_editTextTextPassword_rpw"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:ems="10"
                android:inputType="textPassword"
                android:hint="password"/>

        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="60dp"
            android:layout_weight="1"
            android:orientation="horizontal">
            <TextView
                android:id="@+id/rest_textView_rph"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight="3"
                android:text="手機號碼(phone)"
                android:textStyle="bold"
                android:textSize="13sp"
                android:gravity="center"/>

            <EditText
                android:id="@+id/rest_editTextPhone_rph"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:ems="10"
                android:inputType="phone"
                android:hint="phone"/>
        </LinearLayout>

        <CheckBox
            android:id="@+id/rest_checkBox"
            android:layout_width="match_parent"
            android:layout_height="30dp"
            android:layout_weight="1"
            android:text="我不是機器人"
            android:textStyle="bold"
            android:textSize="15sp"/>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="60dp"
            android:layout_weight="1"
            android:orientation="horizontal">
            <Button
                android:id="@+id/rest_button_reg"
                android:layout_width="100dp"
                android:layout_height="40dp"
                android:layout_gravity="center"
                android:layout_weight="1"
                android:layout_marginLeft="25dp"
                android:layout_marginRight="25dp"
                android:text="註冊"
                android:textStyle="bold"
                android:textSize="15sp"/>

        </LinearLayout>

    </LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

成果展示:
https://ithelp.ithome.com.tw/upload/images/20251001/20168805NFvHjDRmIU.png

在下一篇中,我將帶領大家繼續展開前端的冒險之旅,撰寫註冊介面功能的程式碼,撰寫 註冊介面的功能程式碼,讓「註冊按鈕」真正能把資料送出,完成註冊流程 。


上一篇
Day16行程管家的外貌:讓登入介面動起來(下)
下一篇
Day18 行程管家的外貌:讓帳號系統完整起來
系列文
結合AI Agent技術打造自己的行程管家22
圖片
  熱門推薦
圖片
{{ item.channelVendor }} | {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言